
//
//  THChooseTimeView.m
//  TaiHaoCloud
//
//  Created by rzm on 16/6/13.
//  Copyright © 2016年 rzm. All rights reserved.
//

#import "SampuxTimeChooseCell.h"

@interface SampuxTimeChooseCell ()

{
    UIButton *_lastSeletedBtn;
}

@end

@implementation SampuxTimeChooseCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame: frame]) {
        [self loadUI];
    }
    return self;
    
}

- (void)loadUI
{
    [UIView createLineViewInTop:self];
    CGFloat font = 8.;
    if (IS_IPHONE_4_OR_LESS) {
        font = 12.;
    }else if (IS_IPHONE_5_OR_LESS)
    {
        font = 14.;
    }else if (IS_IPHONE_6)
    {
        font = 16.;
    }else
    {
        font = 16.;
    }
    _timeImg = [UIButton createButton];
    _timeImg.frame = CGRectMake(Sampux6WScale(37), self.height * 0.2, self.height * 0.6, self.height * 0.6);
    [self addSubview:_timeImg];
    
    
    _timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_timeImg.frame) + self.width * 0.05, self.height * 0.2, 60, self.height * 0.6)];
    [self addSubview:_timeLabel];
    _timeLabel.font = THFont(font);
    _timeLabel.text = @"00:00";
    _timeLabel.textColor = THWhiteAlplaColor(0.8);
    
    
    _speedLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_timeLabel.frame) + self.width * 0.05, self.height * 0.2, 60, self.height * 0.6)];
    [self addSubview:_speedLabel];
    _speedLabel.font = THFont(font);
    _speedLabel.textColor = THWhiteAlplaColor(0.8);
//    _speedLabel.text = @"0 ℃";

    _seletedBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _seletedBtn.frame = CGRectMake(self.width * 0.95 - self.height * 0.6, self.height * 0.2, self.height * 0.6, self.height * 0.6);
    [self addSubview:_seletedBtn];
    [_seletedBtn setCorner:_seletedBtn.height/2];
    [_seletedBtn addTarget:self action:@selector(selectBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    _seletedBtn.hitTestEdgeInsets = UIEdgeInsetsMake(-10, -10, -10, -20);

}

- (void)selectBtnClick:(UIButton *)btn
{    
    if (self.cellDelegate && [self.cellDelegate respondsToSelector:@selector(clickTHChooseTimeCellSeleted:)]) {
        [self.cellDelegate clickTHChooseTimeCellSeleted:btn];
    }
}


//- (void)setHourStr:(NSString *)hourStr
//{
//    _hourStr = hourStr;
//    _timeLabel.text = [NSString stringWithFormat:@"%@:%@",self.hourStr,self.minStr];
//}
//
//- (void)setMinStr:(NSString *)minStr
//{
//    _minStr = minStr;
//    _timeLabel.text = [NSString stringWithFormat:@"%@:%@",self.hourStr,self.minStr];
//}

@end
